<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/template.xhtml">

    <ui:define name="title">
        FileUpload <span class="subitem">Basic</span>
    </ui:define>

    <ui:define name="description">
        Simple uploader uses native browser file upload. When 'auto' is set to to 'true', AJAX is used to automatically upload it.
    </ui:define>

    <ui:param name="documentationLink" value="/components/fileupload"/>
    <ui:param name="widgetLink" value="FileUpload-1"/>

    <ui:define name="implementation">

        <p:growl id="messages" showDetail="true"/>
        <div class="card">
            <h5>Single</h5>
            <h:form id="frmSingle">
                <p:fileUpload id="upload" value="#{fileUploadView.file}"
                              mode="simple" skinSimple="true" auto="true"
                              process="@this" update="messages"
                              listener="#{fileUploadView.handleFileUpload}" />
            </h:form>
        </div>
        <div class="card">
            <h5>Single (allowTypes &amp; sizeLimit CSV)</h5>
            <h:form id="frmSingleCSV">
                <p:fileUpload id="upload" value="#{fileUploadView.file}"
                              mode="simple" skinSimple="true" auto="true"
                              process="@this" update="messages"
                              listener="#{fileUploadView.handleFileUpload}">
                    <p:validateFile allowTypes="/(\.|\/)(pdf)$/" sizeLimit="100" />
                </p:fileUpload>
            </h:form>
        </div>
        <div class="card">
            <h5>Multiple</h5>
            <h:form id="frmMulti">
                <p:fileUpload id="upload" value="#{fileUploadView.files}"
                              mode="simple" skinSimple="true" multiple="true" auto="true"
                              process="@this" update="messages"
                              listener="#{fileUploadView.handleFilesUpload}"/>
            </h:form>
        </div>
        <div class="card">
            <h5>Multiple (allowTyped &amp; sizeLimit &amp; fileLimit CSV)</h5>
            <h:form id="frmMultiCSV">
                <p:fileUpload id="upload" value="#{fileUploadView.files}"
                              mode="simple" skinSimple="true" multiple="true" auto="true"
                              process="@this" update="messages"
                              listener="#{fileUploadView.handleFilesUpload}"
                              allowTypes="/(\.|\/)(pdf)$/" sizeLimit="100" fileLimit="2" />
            </h:form>
        </div>
    </ui:define>

</ui:composition>
